1. Field of the Invention
The present invention relates to an image processing apparatus and a method and a recording medium therefor. More particularly, the image processing apparatus and method and a recording medium of the present invention are ideally adapted for correcting the gray level of an image according to the dynamic range of an image output apparatus, such as a display or a printer.
2. Description of the Related Art
Recent developments in image signal acquiring equipment incorporating a solid-state image sensing device or a charge-coupled device (CCD), such as a digital camera or a scanner, have led to the improved performance of the solid-state image sensing device, permitting multi-stage exposures. This has made it possible to acquire image signals in a wider gray level dynamic range (hereinafter referred to as xe2x80x9cthe wide dynamic range image signalsxe2x80x9d).
Meanwhile, the recording formats of media for recording image signals, the formats of signals output to displays or printers, broadcast signal formats, and the like are still limited to the conventional dynamic ranges of 8-bit width or 10-bit width (hereinafter referred to as xe2x80x9cthe narrow dynamic rangexe2x80x9d.
Accordingly, to output image signals from electronic equipment capable of acquiring image signals of a wide dynamic range to other electronic equipment of the conventional narrow dynamic range, it is necessary to correct the gray levels of the image signals of the wide dynamic range, that is, to narrow the dynamic range.
Japanese Unexamined Patent Application Publication No. 9-331539 discloses a technique for correcting the dynamic range of image signals by individually correcting the gray levels of the signals of the three primary colors, Red, Green, and Blue (R, G, and B,) in a broadcasting video camera. FIG. 1 illustrates an example of the configuration of a gray level correction processor in such a broadcasting video camera. In the gray level correction processor, the three primary color signals R, G, and B are supplied to a correction parameter arithmetic circuit 1, and also to their corresponding gray level correction circuits 2R, 2G, and 2B, respectively.
The correction parameter arithmetic circuit 1 uses the received three primary color signals R, G, and B to generate luminance signals, and computes correction parameters on the basis of the luminance signals, then outputs the computed correction parameters to the gray level correction circuits 2R, 2G, and 2B.
The gray level correction circuit 2R includes a lookup table (hereinafter referred to as xe2x80x9cLUTxe2x80x9d) for correcting the gray level of a red signal R. The circuit 2R checks the correction parameter and the red signal R, which have been received from the correction parameter arithmetic circuit 1, against the built-in LUT, and outputs the associated value to a gamma correction circuit 3 as a correction value. The gray level correction circuit 2G includes a LUT for correcting the gray level of a green signal G. The circuit 2G checks the correction parameter and the green signal G, which have been received from the correction parameter arithmetic circuit 1, against the built-in LUT, and outputs the associated value to the gamma correction circuit 3 as a correction value. The gray level correction circuit 2B includes a LUT for correcting the gray level of a blue signal B. The circuit 2B checks the correction parameter and the blue signal B, which have been received from the correction parameter arithmetic circuit 1, against the built-in LUT, and outputs the associated value to the gamma correction circuit 3 as a correction value.
A gamma correction circuit 3R carries out a gamma correction on the corrected red signal R received from the gray level correction circuit 2R, and outputs the result to a matrix circuit 4. A gamma correction circuit 3G carries out a gamma correction on the corrected green signal G received from the gray level correction circuit 2G, and outputs the result to the matrix circuit 4. A gamma correction circuit 3B carries out a gamma correction on the corrected blue signal B received from the gray level correction circuit 2B, and outputs the result to the matrix circuit 4. The matrix circuit 4 coverts the gamma-corrected three primary color signals R, G, and B into a luminance signal Y0and color-difference signals Cr0and Cb0.
The gray level correction processor shown in FIG. 1 performs the gray level correction on the three primary color signals R, G, and B, respectively, at the same ratio. Hence, it is possible to compress the dynamic range of image signals to a desired width without causing a change in hue.
The gray level correction processor, however, requires the gray level correction circuits 2 and the gamma correction circuits 3 for the three primary color signals R, G, and B, respectively. This leads to a problem in that using the gray level correction processor in a consumer appliance, such as a digital camera, a video camera, or a television receiver, inevitably results in higher cost and a greater circuit scale.
Japanese Unexamined Patent Application Publication No. 11-55598 has disclosed a technique for correcting the dynamic range of image signals by performing gray level corrections only on the luminance signal Y among the image signals in a television receiver. FIG. 2 illustrates an example of the configuration of a gray level correction processor for such a television receiver.
In the gray level correction processor, a received luminance signal Y is supplied to a correction parameter arithmetic circuit 11, a luminance correction circuit 12, and a color-difference correction circuit 13, while received color-difference signals Cr and Cb are supplied to the color-difference correction circuit 13.
Based on a received luminance signal Y, the correction parameter arithmetic circuit 11 computes a correction parameter with which an optimum gray level correction will be made in the luminance correction circuit 12, and outputs the computed correction parameter to the luminance correction circuit 12. The luminance correction circuit 12, which includes a LUT for correcting the gray level of the luminance signal Y, checks the correction parameter and the luminance signal Y received from the correction parameter arithmetic circuit 11 against the built-in LUT, and outputs an associated value as a correction value Y0. The correction value Y0 is also supplied to the color-difference correction circuit 13.
The color-difference correction circuit 13 performs normalization by multiplying the color-difference signals Cr and Cb by Y0/Y, which is a ratio of the luminance signal Y before gray level correction to the luminance signal Y0 after the correction, and generates color-difference signals Cr0 and Cb0 so as to maintain the ratio of the color-difference signals Cr and Cb to the input luminance signal Y.
The gray level correction processor shown in FIG. 2 requires fewer constituent parts since it is adapted to carry out gray level corrections only on the luminance signal Y, thus controlling an increase in cost and circuit scale. The gray level correction processor of FIG. 2, however, presents the problems described below.
First, an error occurs in correcting the luminance of a pixel having a larger color-difference signal value. The relationship between three primary color signals R, G and B, and the luminance signal Y or the color-difference signals Cr and Cb is represented by expressions (1) and (2) shown below:
Y=0.30R+0.59G+0.11Bxe2x80x83xe2x80x83(1)
Cr=R-Y
Cb=B-Yxe2x80x83xe2x80x83(2)
In correcting the gray level of the luminance signal Y, the information regarding the color-difference signals Cr and Cb is not taken into account. The information indicating the balance among the three primary color signals R, G, and B is missing in the luminance signal Y. For this reason, the gray level correction of the luminance signal Y is not properly made on a pixel in which the three primary color signals R, G, and B are unbalanced, that is, a pixel having a greater color difference.
For instance, if an input red signal R has a maximum value (assumed to be 1), while input green signal G and blue signal B have minimum values (assumed to be 0), then the input luminance signal Y will be 0.3.
Such a pixel should be converted into a pixel in which the red signal R has the maximum value (assumed to be 1), while the green signal G and the blue signal B have the minimum value (assumed to be 0) after a gray level correction is made. After this conversion, the luminance signal Y of the pixel will be 0.3.
However, if, for example, the luminance correction circuit 12 is provided with the luminance correction LUT as shown in FIG. 3, then the luminance signal Y =0.3 will be converted into the luminance signal Y0=0.6 in accordance with the luminance correction LUT, generating an error, as compared with a proper correction value (0.3 in this case). This problem may arise with all pixels other than achromatic pixels.
Second, a change in hue takes place. To be more specific, if, for example, the input red signal R has a maximum value, while the input green signal G and blue signal B have minimum values, then the color-difference signal Cr will have the maximum value. At this time, if the luminance signal Y=0.3 is converted into Y0=0.6 in accordance with the LUT shown in FIG. 3, then the color-difference correction circuit 13 will multiply the color-difference signal Cr by 2 (=0.6/0.3).
The color-difference signal Cr, however, already has the maximum value, so that clipping will cause no changes, whereas the color-difference signal Cb, which does not take the maximum value, will be multiplied by 2. This poses a problem in that the value of Cr/Y cannot be maintained at a constant level and a hue change undesirably takes place.
Even if the value of Cr/Y is maintained constant by avoiding clipping on the color-difference signal Cr, the clipping will be eventually effected on the red signal R at the time of conversion into the three primary color signals R, G, and B, thus again causing an undesirable hue change to take place.
The present invention has been made with a view toward solving the above problems, and it is an object of the present invention to control the occurrence of a change in hue by adjusting the correction amount for a color-difference signal according to the gray level correction characteristic of a luminance signal when gray level correction is made only on a luminance signal Y of a pixel having a great color-difference signal value.
To this end, according to one aspect of the present invention, there is provided an image processing apparatus including a first generating device for generating a first conversion rule by using a first element of an input image signal, a second generating device for generating a second conversion rule on the basis of the first conversion rule, a first correcting device for correcting the first element of the input image signal by using the first conversion rule, an acquiring device for acquiring a correction parameter associated with the first element of the input image signal by using the second conversion rule, and a second correcting device for correcting a second element of the input image signal by using the correction parameter.
The first generating device may include a preparing device for preparing a histogram of the first element of the input image signal, an accumulating device for accumulating histograms to prepare a cumulative histogram, and an approximating device for approximating the cumulative histogram to a predetermined logarithmic curve thereby generating the first conversion rule.
The second correcting device may be adapted to correct the second element of the input image signal by multiplying the second element by the correction parameter.
The image processing apparatus according to the present invention may further include a converting device for converting an optical signal of a subject into a color signal, and a calculating device for calculating the first and second elements of the image signal on the basis of the color signal.
The converting device may be adapted to convert the optical signal of the subject into a red signal, a green signal, or a blue signal.
The converting device may be adapted to convert the optical signal of the subject into a yellow signal, a cyan signal, or a green signal.
The converting device may be adapted to convert the optical signal of the subject into a yellow signal, a cyan signal, a magenta signal, or a green signal.
According to another aspect of the present invention, there is provided an image processing method including a first generating step for generating a first conversion rule by using a first element of an input image signal, a second generating step for generating a second conversion rule on the basis of the first conversion rule, a first correcting step for correcting the first element of the input image signal by using the first conversion rule, an acquiring step for acquiring a correction parameter associated with the first element of the input image signal by using the second conversion rule, and a second correcting step for correcting a second element of the input image signal by using the correction parameter.
According to yet another aspect of the present invention, there is provided a recording medium in which a program has been recorded, the program including a first generating step for generating a first conversion rule by using a first element of an input image signal, a second generating step for generating a second conversion rule on the basis of the first conversion rule, a first correcting step for correcting the first element of the input image signal by using the first conversion rule, an acquiring step for acquiring a correction parameter associated with the first element of the input image signal by using the second conversion rule, and a second correcting step for correcting a second element of the input image signal by using the correction parameter.
According to the image processing apparatus and method and the program recorded in the recording medium therefor in accordance with the present invention, a first conversion rule is generated by using a first element of an input image signal, and a second conversion rule is generated on the basis of the first conversion rule. Furthermore, the first conversion rule is used to correct the first element of the input image signal, a correction parameter associated with the first element of the input image signal is acquired by using the second conversion rule, and a second element of the input image signal is corrected by using the correction parameter.
Additional features and advantages of the present invention are described in, and will be apparent from, the following Detailed Description of the Invention and the figures.